package dk.dashboardFP.panels.displayPanel {
	import com.gskinner.motion.GTweener;

	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;

	/**
	 * @author josef
	 */
	public class ListShortCutButton extends Sprite {
		private var _asset : TitleBarButtonAsset;
		private var _iconIndex : int;
		private var _back : MovieClip;
		private var _downAlpha : Number=0.1;

		public function ListShortCutButton(iconIndex:int=1) {
			_iconIndex = iconIndex;
			setupElements();
		}
		
		private function setupElements() : void {
			
			//:::::::
			// asset
			_asset=new TitleBarButtonAsset();
			addChild(_asset);
			
			_asset.gotoAndStop(_iconIndex);
			
			_back = _asset.mcBack;
			_back.alpha=_downAlpha;
			
			//:::::::
			// event 
			addEventListener(MouseEvent.MOUSE_OVER, mouseOver, false, 0, true);
			addEventListener(MouseEvent.MOUSE_OUT, mouseOut, false, 0, true);
			
			buttonMode=true;
			
		}

		private function mouseOver(e:Event) : void {
			GTweener.removeTweens(_back);
			GTweener.to(_back, 0.1, {alpha:0.5});
 		}

		private function mouseOut(e:Event) : void {
			GTweener.removeTweens(_back);
			GTweener.to(_back, 0.1, {alpha:_downAlpha});
		}
	}
}
